<template>
	<view class="content">
		<uamhead :title="title"></uamhead>
		<scroll-view scroll-y="true" >
			<view>
				<m-for-skeleton
				:avatarSize="200"
				:row="3"
				:title="false"
				:loading="loading"
				isarc="square"
				:titleStyle="{}"
				v-for="(item,key) in 4"
				:key="key">
				</m-for-skeleton>
			</view>
			<view class="index-list" v-for="(item,index) in playlist" :key="index" @click="handleToList(item.id)">
				<view class="index-list-item">
					<view class="index-list-img">
						<image :src="item.coverImgUrl" mode=""></image>
						<text>{{item.updateFrequency}}</text>
					</view>
					<view class="index-list-text">
						<view  v-for="(musicItem,index) in item.tracks" :key="index">
							{{index+1}}.{{musicItem.first}}-{{musicItem.second}}
						</view>
					</view>
				</view>
			</view>
			
		</scroll-view>
	</view>
</template>

<script>
	import { topList } from '../../common/api.js'
	// const toplistdata=require('@/static/toplist.json')
	import mForSkeleton from "@/components/m-for-skeleton/m-for-skeleton";
	import uamhead from "../../components/uamhead/uamhead.vue"
	export default {
		components: {
		    mForSkeleton
		},
		data() {
			return {
				playlist:[],
				title: 'UAMusic',
				loading: true
			}
		},
		onLoad() {
			// this.playlist= toplistdata;
			topList().then((res)=>{
							if(res.length){
								setTimeout(()=>{
									this.playlist = res;
									this.loading=false
								},2000);
							}
						});
		},
		methods: {
			handleToList(id){
				uni.navigateTo({
					url:'/pages/list/list?listid='+id
				})
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
	.index-list{ margin:0 30rpx;;width: 95%}
	.index-list-item{ display: flex; margin-bottom: 35rpx;}
	.index-list-img{ width:212rpx; height:212rpx; margin-right:20rpx; border-radius: 15rpx; overflow: hidden; position: relative;}
	.index-list-img image{ width:100%; height:100%;}
	.index-list-img text{ position: absolute; font-size:22rpx; color:white; bottom: 15rpx; left:15rpx;}
	.index-list-text{ flex:1; font-size:24rpx; line-height: 68rpx;}
	.index-list-text view{}
</style>
